/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package digitaldreamers.games.ddmonsters.servers.gameserver.network.packets.sending;

import digitaldreamers.libraries.games.servers.networkmanagement.packets.sending.AbSendablePacket;
import digitaldreamers.games.ddmonsters.servers.gameserver.components.RoomComponent;
import digitaldreamers.games.ddmonsters.servers.gameserver.configurations.Configuration;
import java.io.DataOutputStream;
import java.io.IOException;

/**
 *
 * @author DaoLe
 */
public class SGetRoomListRequestResponse extends AbSendablePacket {
    private RoomComponent[] m_RoomList;
    
    public SGetRoomListRequestResponse(RoomComponent[] roomList) {
        m_RoomList = roomList;
        mPacketId = Configuration.GET_ROOM_LIST_REQUEST_RESPONSE_ID;
    }
    
    @Override
    public void writeData(DataOutputStream DOS) throws IOException {
        DOS.writeInt(mPacketId);
        DOS.writeInt(m_RoomList.length);
        for(int i = 0; i < m_RoomList.length; i++) {
            DOS.writeLong(m_RoomList[i].getRoomID());
            //DOS.writeInt(roomList[i].getRoomRule().getRule());
            DOS.writeUTF(m_RoomList[i].getRoomMaster().getPlayerInformation().getLogin());
            //DOS.writeInt(roomList[i].getRoomMaster().getPlayerInfo().getLevel());
        }
    }
}
